<?php

declare(strict_types=1);

namespace App\CustHub\Controller;

use App\CustHub\Annotation\ApiAuth;
use App\CustHub\Annotation\VerifySignature;
use App\CustHub\Request\EmployeeRequest;
use App\CustHub\Service\ChEmployeeService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;

/**
 * 企微成员
 */
#[Controller(prefix: 'ch/employee'), ApiAuth, VerifySignature]
class EmployeeController extends BaseController
{
    #[Inject]
    protected ChEmployeeService $service;


    #[PostMapping('list')]
    public function list(EmployeeRequest $request)
    {
        return $this->success($this->service->getEmployeeList($request->all()));
    }

    #[PostMapping('sync')]
    public function sync(EmployeeRequest $request)
    {
        return $this->service->sync($request->all()) ? $this->success('同步中，请稍后查看') : $this->error('同步失败');
    }
}